<?php 

class SMTransmitter{
    private $reporter=null;
    private $messageFields=null; // assoc array of message fields
    private $config=array(); // array storing config values
    public static $instance=null;

    public function __construct($reporter){
        $this->setReporter($reporter);
    }

    public static function getInstance($reporter){
        if(self::$instance === null){
            self::$instance = new SMTransmitter($reporter);
        }

        return self::$instance;
    }

    public function setReporter($reporter=null){
        if($reporter !== null){
            $this->reporter = $reporter;
        }else{
            trigger_error(__CLASS__ . ": application must pass a reporter object to the SMTransmitter constructor", E_USER_ERROR);
            die();
        }

        return true;
    }

    public function sendMessage($message, $receiver_url){
        return $this->reporter->sendMessage(base64_encode($message), $receiver_url);
    }
}
?>